import unittest
import os
from library.HTMLTestRunnerNew import HTMLTestRunner
from common.my_path import CASE_PATH,REPORTS_PATH
from tool.random_number import get_time

# 创建测试套件
suite = unittest.TestSuite()

# 加载测试用例
loader = unittest.TestLoader()
suite.addTest(loader.discover(CASE_PATH))

# 运行测试用例
report = os.path.join(REPORTS_PATH,'report.html')

with open(report,'wb')as f:
    runner = HTMLTestRunner(stream=f,
                            title='接口报告',
                            description='测试报告描述....',
                            tester='***'
                            )
    runner.run(suite)